package com.l.web.common;

import java.util.HashMap;
import java.util.Map;

public class ResponseInfo {

    private Long code;

    private Map data;

    public ResponseInfo() {
        super();
    }

    public ResponseInfo(boolean result) {
        super();
        setCode(result);
    }

    public ResponseInfo(int code) {
        super();
        setCode(code);
    }

    public ResponseInfo(long code) {
        super();
        setCode(code);
    }

    public void setCode(long code) {
        this.code = code;
    }

    public void setCode(boolean result) {
        if (result) {
            this.setCode(ResponseCode.SUCCESS);
        } else {
            this.setCode(ResponseCode.FAILURE);
        }
    }

    public long getCode() {
        return code;
    }

    public Object put(String key, Object value) {
        synchronized (this) {
            if (this.data == null) {
                this.data = new HashMap();
            }

            return this.data.put(key, value);
        }
    }
}